import { Http } from "../utils/http";

// 商品
class Spu {
  /**
   * // 判断SkuList为空
   * @param {*} spu spu详情信息
   * @returns
   */
  static isNoSpec(spu) {
    if (
      spu &&
      spu.sku_list &&
      spu.sku_list.length === 1 &&
      spu.sku_list[0].specs.length === 0
    ) {
      return true;
    }
    return false;
  }

  /**
   * 获取规格 spu详情
   * @param {*} id spu pid
   * @returns
   */
  static getDetail(id) {
    return Http.request({
      url: `/v1/spu/id/${id}/detail`,
    });
  }
}

export { Spu };
